#include "Camera.h"


Camera::Camera(sf::IntRect charRect )
    : view(sf::FloatRect(-400 + charRect.Left + charRect.Width / 2, -300 + charRect.Top + charRect.Height / 2, 800, 600))
{

}

sf::View Camera::getView() const
{
    return view;
}

void Camera::move( sf::Vector2i move )
{
    view.Move((sf::Vector2f)move);
}

void Camera::move( int x, int y )
{
    view.Move(sf::Vector2f(x, y));
}

void Camera::move( sf::Vector2f move )
{
    view.Move(move);
}

void Camera::characterMove( sf::Vector2f move, sf::IntRect charRect )
{
//     sf::Vector2f characterMiddleVect
//         (charRect.Left + charRect.Width / 2
//         ,charRect.Top + charRect.Height / 2);
//     if (characterMiddleVect.x - view.GetCenter().x + 400 <= view.GetSize().x / 3 ||
//         characterMiddleVect.x - view.GetCenter().x + 400 >= view.GetSize().x / 3 * 2 ||
//         characterMiddleVect.y - view.GetCenter().y + 300 <= view.GetSize().y / 3 ||
//         characterMiddleVect.y - view.GetCenter().y + 300 >= view.GetSize().y / 3 * 2)
//     {
        view.Move(move);
//     }
}
